package com.example.demo.controller;

import com.example.demo.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author liuyandeng
 * @date 2023/7/23
 * @Description
 */



@Controller
@ResponseBody
@RequestMapping("/stu")
public class StudentController {

    @Autowired
    private Student student;

    @RequestMapping("/id") // localhost:9999/stu/id
    public int getId() {
        return student.getId();
    }

    @RequestMapping("/name")
    public String getName() {
        return student.getName();
    }

    @RequestMapping("/age")
    public int getAge() {
        return student.getAge();
    }
}
